<template>
  <div class="bank">
    <div class="square_header flex align_center">
      <div
        class="square_header_item"
        :class="active == index ? 'underline ' : ''"
        v-for="(item,index) in activity"
        style="width:120px;"
        :key="index"
        @click="checkItem(index)"
      >
        <span
          :class="active == index ? 'title1 color1 zIndex fontBold ' : 'default'"
        >{{ item.name }}</span>
      </div>
    </div>
    <component :is="active == 0 ? friends : holder " />
  </div>
  <div class="fexd_footer">
    <div class="footer_btn flex align_center justify_between">
      <div class="flex align_center">
        <div
          @click="back"
          class="agree font400 content3 color4"
        >
          返回
        </div>
      </div>
    </div>
  </div>
</template>

<script setup lang="ts">
import { ref } from 'vue'
import { useRouter, useRoute } from 'vue-router'
import { useStore } from 'vuex'
import friends from './friends.vue'
import holder from './holder.vue'
// import { getexchangehandle } from '@/api/index'
const router = useRouter()
const route = useRoute()
const store = useStore()
const active: any = ref(route.query.s || 0)
const activity: any = ref([
  {
    name: '交换申请'
  },
  {
    name: '名片夹'
  }
])

const checkItem = (index: any) => {
  router.replace({
    path: '/userCenter/card',
    query: { s: index }
  })
  active.value = index
}

const back = () => {
  if (store.state.from.path !== '/') {
    router.back()
  } else {
    router.replace('/')
  }
}

</script>

<style lang="less" scoped>
.bank {
    padding: 0 15px 80px;
    margin-top: 40px;
}
.square_header {
    .square_header_item {
        margin-right: 29px;
        text-align: center;
        .default {
            font-size: 19px;
            font-weight: bold;
            color: #454757;
        }
    }
}

.fexd_footer {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 70px;
    background-color: #fff;
    box-shadow: 0px 2px 12px 2px rgba(22, 12, 6, 0.09);
    .footer_btn {
        padding: 0 30px;
        height: 100%;
        text-align: center;
        .agree {
            width: 315px;
            height: 44px;
            background: #85898c;
            border-radius: 5px;
            text-align: center;
            line-height: 44px;
        }
    }
}
@media (min-width: 750px) {
  .bank {
    padding: 0 15px 80px;
    margin-top: 40px;
}
.square_header {
    .square_header_item {
        margin-right: 29px;
        text-align: center;
        .default {
            font-size: 19px;
            font-weight: bold;
            color: #454757;
        }
    }
}

.fexd_footer {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 70px;
    background-color: #fff;
    box-shadow: 0px 2px 12px 2px rgba(22, 12, 6, 0.09);
    .footer_btn {
        padding: 0 30px;
        height: 100%;
        text-align: center;
        .agree {
            width: 315px;
            height: 44px;
            background: #85898c;
            border-radius: 5px;
            text-align: center;
            line-height: 44px;
        }
    }
}
}
</style>
